<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>批阅中</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    {load href="/static/css/bootstrap.min.css" /}
    {load href="/static/css/mycss.css" /}
    {load href="/static/css/dfjs_public.css" /}

    {load href="/static/js/jquery.js" /}
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    {load href="/static/js/bootstrap.min.js" /}

    <script>
    </script>
    <style>
        .green{color: #008800}
        .red{color: #dd0000}
        .gray{color: #848484}
        .orange{color: #ec6827}
    </style>

</head>
<body>
<div class="container" >
    <div class="row bb pb5">
        <h3 class="fl">{$paper.title}</h3>
        <button class="btn btn-warning pull-right pw25 mt15">批阅中</button>
    </div>
    <div class="row pb5">
        <p class="ph15">
            <span>答题人：{$result.phone}</span>
            <span>交卷时间：{$result.create_time}</span>
            <span>用时：{$result.usetime}</span>
        </p>
    </div>
    <div class="row pb5">
        <table style="text-align: center" class="table table-bordered">
            <tr><td rowspan='5' style="vertical-align: middle;"><span style="font-size: 26px;color: #ec6827;">{$result.paperScore}</span>&nbsp;&nbsp;<span style="font-size: 16px;color: #ec6827;">分</span><br/>总分{$paper.allscore}分</td><td></td><td>单选题(道)</td><td>多选题(道)</td><td>不定项选择题(道)</td><td>填空题(道)</td><td>判断题(道)</td><td>问答题(道)</td></tr>
            <tr><td>答对</td><td class="green">{$result.singleright}道</td><td class="green">{$result.mulright}道</td><td class="green">{$result.ideright}道</td><td class="green">{$result.fillright}道</td><td class="green">{$result.judgeright}道</td><td rowspan="4" style="vertical-align: middle;">{$result.shortundo}道未答;得分？</td></tr>
            <tr><td>答错</td><td class="red">{$result.singleerror}道</td><td class="red">{$result.mulright}道</td><td class="red">{$result.ideerror}道</td><td class="red">{$result.fillerror}道</td><td class="red">{$result.judgeerror}道</td></tr>
            <tr><td>未答</td><td class="gray">{$result.singleundo}道</td><td class="gray">{$result.mulundo}道</td><td class="gray">{$result.ideundo}道</td><td class="gray">{$result.fillundo}道</td><td class="gray">{$result.judgeundo}道</td></tr>
            <tr><td>得分</td><td class="orange">{$result.singleright * 2}分</td><td class="orange">{$result.mulscore}分</td><td class="orange">{$result.idescore}分</td><td class="orange">{$result.fillright}分</td><td class="orange">{$result.judgeright}分</td></tr>
        </table>
    </div>
    <div class="row" id="toolbar">
        <ul class="nav nav-pills" id="nav_top">
            <li class="active"><a href="#xuanze">单选题</a></li>
            <li><a href="#duoxuan">多选题</a></li>
            <li><a href="#buding">不定项选择题</a></li>
            <li><a href="#tiankon">填空题</a></li>
            <li><a href="#panduan">判断题</a></li>
            <li><a href="#jianda">简答题</a></li>
        </ul>
    </div>

    <div class="row" data-spy="scroll" data-target="#listbar" data-offset="0">

        <div class="col-xs-9 pr15" data-spy="scroll" data-target="#toolbar" data-offset="0" style="height:750px;overflow:auto;">

            <div class="row mr0">
                <div class="panel panel-default">
                    <div class="panel-heading"  id="xuanze"><strong>一、单选题</strong></div>
                    <div class="panel-body">
                        {foreach name="single" item="list" key="k"}
                        <div class="row">
                            <div class="col-xs-1">
                                <p class="text-primary fz18 fr">{$k+1}</p>
                                <input type="button" class="btn btn-default btn-xs co-gray pull-right" value="{$list.score}分" disabled />
                            </div>

                            <div class="col-xs-11">
                                {$list.title}
                                <hr class="dash">
                                <br />
                                <p>A.&nbsp;&nbsp;{$list.optionA}</p>
                                <p>B.&nbsp;&nbsp;{$list.optionB}</p>
                                <p>C.&nbsp;&nbsp;{$list.optionC}</p>
                                <p>D.&nbsp;&nbsp;{$list.optionD}</p>
                                <hr class="dash">
                                <p class="singlechoice">
                                    <label class="radio-inline">
                                        <input type="radio" name="answers{$list.id}" value="1" data-id="{$list.id}" class="single"> A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="answers{$list.id}" value="2" data-id="{$list.id}"  class="single"> B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="answers{$list.id}" value="3" data-id="{$list.id}"  class="single"> C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="answers{$list.id}" value="4" data-id="{$list.id}"  class="single"> D
                                    </label>
                                </p>
                            </div>
                        </div>

                        <br />
                        <br />
                        <hr />
                        {/foreach}

                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading"  id="duoxuan"><strong>二、多选题</strong></div>
                    <div class="panel-body">
                        {foreach name="mul" item="list" key="k"}
                        <div class="row">
                            <div class="col-xs-1">
                                <p class="text-primary fz18 fr">{$k+1}</p>
                                <input type="button" class="btn btn-default btn-xs co-gray pull-right" value="{$list.score}分" disabled />
                            </div>

                            <div class="col-xs-11">
                                {$list.title}
                                <hr class="dash">
                                <br />
                                <p>A.&nbsp;&nbsp;{$list.optionA}</p>
                                <p>B.&nbsp;&nbsp;{$list.optionB}</p>
                                <p>C.&nbsp;&nbsp;{$list.optionC}</p>
                                <p>D.&nbsp;&nbsp;{$list.optionD}</p>
                                <hr class="dash">
                                <p class="mulchoice">
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answerm{$list.id}" value="1" data-id="{$list.id}" class="mul"> A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answerm{$list.id}" value="2" data-id="{$list.id}" class="mul"> B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answerm{$list.id}" value="3" data-id="{$list.id}" class="mul"> C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answerm{$list.id}" value="4" data-id="{$list.id}" class="mul"> D
                                    </label>
                                </p>
                            </div>
                        </div>

                        <br />
                        <br />
                        <hr />
                        {/foreach}
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading" id="buding"><strong>三、不定项选择题</strong></div>
                    <div class="panel-body">
                        {foreach name="ide" item="list" key="k"}
                        <div class="row">
                            <div class="col-xs-1">
                                <p class="text-primary fz18 fr">{$k+1}</p>
                                <input type="button" class="btn btn-default btn-xs co-gray pull-right" value="{$list.score}分" disabled />
                            </div>

                            <div class="col-xs-11">
                                {$list.title}
                                <hr class="dash">
                                <br />
                                <p>A.&nbsp;&nbsp;{$list.optionA}</p>
                                <p>B.&nbsp;&nbsp;{$list.optionB}</p>
                                <p>C.&nbsp;&nbsp;{$list.optionC}</p>
                                <p>D.&nbsp;&nbsp;{$list.optionD}</p>
                                <hr class="dash">
                                <p class="idechoice">
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answeri{$list.id}" value="1" data-id="{$list.id}" class="ide"> A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answeri{$list.id}" value="2" data-id="{$list.id}" class="ide"> B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answeri{$list.id}" value="3" data-id="{$list.id}" class="ide"> C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="checkbox" name="answeri{$list.id}" value="4" data-id="{$list.id}" class="ide"> D
                                    </label>
                                </p>
                            </div>
                        </div>

                        <br />
                        <br />
                        <hr />
                        {/foreach}
                    </div>
                </div>
                <div class="panel panel-default" >
                    <div id="tiankon" class="panel-heading"><strong>四、填空题</strong></div>
                    <div class="panel-body">
                        {foreach name="fill" item="list" key="k"}
                        <div class="row">
                            <div class="col-xs-1">
                                <p class="text-primary fz18 fr">{$k+1}</p>
                                <input type="button" class="btn btn-default btn-xs co-gray pull-right" value="{$list.score}分" disabled />
                            </div>

                            <div class="col-xs-11">
                                {$list.title}
                                <hr class="dash">
                                <input type="text" name="answer" class="form-control fillblank" data-id="{$list.id}" placeholder="" value="">
                            </div>
                            <br />
                            <br />
                            <hr>
                        </div>

                        <br />
                        <br />
                        <hr />
                       {/foreach}
                    </div>
                </div>


                <div class="panel panel-default">
                    <div id="panduan" class="panel-heading"><strong>五、判断题</strong></div>
                    <div class="panel-body">
                        {foreach name="judge" item="list" key="k"}
                        <div class="row">
                            <div id="A55" class="col-xs-1">
                                <p class="text-primary fz18 fr">{$k+1}</p>
                                <input type="button" class="btn btn-default btn-xs co-gray pull-right" value="{$list.score}分" disabled />
                            </div>

                            <div class="col-xs-11">
                                {$list.title}
                                <hr class="dash">
                                <p class="judgequ">
                                    <label class="radio-inline">
                                        <input type="radio" name="answerj{$list.id}[]" value="1" data-id="{$list.id}" class="judge"> 正确&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" name="answerj{$list.id}[]" value="0" data-id="{$list.id}" class="judge"> 错误&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                </p>

                            </div>
                            <br />
                            <br />
                            <hr>
                        </div>

                        <br />
                        <br />
                        <hr />
                        {/foreach}
                    </div>
                </div>
                <div class="panel panel-default" >
                    <div id="jianda" class="panel-heading"><strong>五、简答题</strong></div>
                    <div class="panel-body">
                        {foreach name="short" item="list" key="k"}
                        <div class="row">
                            <div class="col-xs-1">
                                <p class="text-primary fz18 fr">{$k+1}</p>
                                <input type="button" class="btn btn-default btn-xs co-gray pull-right" value="{$list.score}分" disabled />
                            </div>

                            <div class="col-xs-11">
                                {$list.title}
                                <hr class="dash">
								<textarea name="answer" class="form-control short" data-id="{$list.id}"></textarea>

                            </div>
                            <br />
                            <br />
                            <hr>
                        </div>

                        <br />
                        <br />
                        <hr />
                        {/foreach}
                    </div>
                </div>


            </div>

        </div>



        <div class="col-xs-3 pl15">
            <div class="row">
                <div class="panel panel-default">
                    <div class="panel-heading"><strong>一、选择题</strong></div>
                    <div class="panel-body">
                        <dl>
                            <dt>一、单选题</dt>
                            {foreach name="single" item="list" key="k"}
                            <dd class="btn btn-default m5">{$k+1}</dd>
                            {/foreach}
                        </dl>
                        <dl>
                            <dt>二、多选题</dt>
                            {foreach name="mul" item="list" key="k"}
                            <dd class="btn btn-default m5">{$k+1}</dd>
                            {/foreach}
                        </dl>
                        <dl>
                            <dt>三、不定项选择题</dt>
                            {foreach name="ide" item="list" key="k"}
                            <dd class="btn btn-default m5">{$k+1}</dd>
                            {/foreach}
                        </dl>
                        <dl>
                            <dt>四、填空题</dt>
                            {foreach name="fill" item="list" key="k"}
                            <dd class="btn btn-default m5">{$k+1}</dd>
                            {/foreach}
                        </dl>
                        <dl>
                            <dt>五、判断题</dt>
                            {foreach name="judge" item="list" key="k"}
                            <dd class="btn btn-default m5">{$k+1}</dd>
                            {/foreach}
                        </dl>
                        <dl>
                            <dt>六、简答题</dt>
                            {foreach name="short" item="list" key="k"}
                            <dd class="btn btn-default m5">{$k+1}</dd>
                            {/foreach}
                        </dl>
                    </div>
                    <div class="panel-footer">
                        <p><input type="checkbox" >只看错题和未作答的</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
    <script>
        $("#submitPaper").click(function(){
            var single={};//单选题
            var mul={};//多选题
            var ide={};//不定项题
            var fill={};//填空题
            var judge={};//判断题
            var short={};//简答题
            $(".panel-default").each(function (index,element) {
                if(index == 0){

                    $(element).find(".singlechoice").each(function (i,ele) {
                        var answers = '';
                        $(ele).find(".single").each(function () {
                            var id = $(this).attr("data-id");
//                        console.log($(this))
                            if ($(this).is(':checked')) {

                                answer = $(this).val();
                                answers = answers + answer
//                            console.log(answer)

                            }
                            single[id] = answers;
                        })
                    })
//                    console.log(single);
                }
                if(index == 1){

                    $(element).find(".mulchoice").each(function (i,ele) {
//                        console.log(ele)
//                        console.log(answers)
                        var answers = '';
                        $(ele).find(".mul").each(function(){
                            id = $(this).attr("data-id");
                            if($(this).is(':checked')) {
                                answer = $(this).val();
                                answers = answers + answer + ','
//                                console.log(answers)

//                            console.log(id)

                            }
                            mul[id]=answers;
                        })
                    })

//                    console.log(mul);
                }
                if(index == 2){

                    $(element).find(".idechoice").each(function (i,ele) {
//                        console.log(ele)
//                        console.log(answers)
                        var answers = '';
                        $(ele).find(".ide").each(function(){
                            id = $(this).attr("data-id");
                            if($(this).is(':checked')) {
                                answer = $(this).val();
                                answers = answers + answer + ','
//                                console.log(answers)
//                            console.log(id)
                            }
                            ide[id]=answers;
                        })
                    })
//
//                    console.log(ide);
                }
                if(index == 3){

                    $(element).find(".fillblank").each(function(){
                        answer = $(this).val();
                        id = $(this).attr("data-id");
                        fill[id]=answer;

                    })
//                    console.log(fill);
                }
                if(index == 4){

                    $(element).find(".judgequ").each(function(ii,ee) {
                        var answers = ''
                        $(ee).find(".judge").each(function () {
                            var id = $(this).attr("data-id");
//                        console.log($(this))
                            if ($(this).is(':checked')) {

                                answer = $(this).val();
//                            console.log(answer)
                                answers = answers + answer
                            }
                            judge[id] = answer;
                        })
                    })
//                    console.log(judge);
                }
                if(index == 5){

                    $(element).find(".short").each(function(){
                        answer = $(this).val();
                        id = $(this).attr("data-id");
                        short[id]=answer;

                    })
//                    console.log(short);
                }
            })
            //异步提交答题信息
            $.ajax({
                url:"{:url('home/Paper/testPaper')}",
                data:{
                    single:single,
                    mul:mul,
                    ide:ide,
                    fill:fill,
                    judge:judge,
                    short:short,
                    paperid:"{$paperid}",
                    usetime:10
                },
                dataType:"json",
                type:"POST",
                success: function(d){
//                    console.log(d)
                    if(d.code == 1){
                        alert('提交成功');

                    }else{
                        alert('提交失败');
                    }
                }
            })
        });
    </script>
</html>